#include "base/core/lua_head.h"
#include "Script/ScriptMgr_CS.h"
#include "Script/GlobalScriptFunc_CS.h"
#include "CenterService.h"

#ifdef _MSC_VER
#pragma warning(disable:4100)
#endif

using namespace luabridge;

uint32_t GetGroupID() 
{
	return g_GetCenterService()->GetZoneId();
}

int GetSceneInfo(lua_State* state)
{
	int result = 0;
	LuaScript* sc = g_GetCSScriptMgr()->GetScript();
	MMOLOG_PROCESS_ERROR(sc);
	MMOLOG_PROCESS_ERROR(sc->GetTopIndex() == 1);
	sc->GetInt(1);

Exit0:
	return result;
}

bool RegistGlobalCSScriptFunc(lua_State* state)
{
	getGlobalNamespace(state)
		// normal function
		.addFunction("GetGroupID", GetGroupID)
		// c function
		.addCFunction("GetSceneInfo", GetSceneInfo)
		;

	return true;
}
